#!/bin/bash
set -ex

DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd);
cd "$DIR" || exit
echo "$DIR"
echo start to build docker container
tag=$(head -n 1 app/.version)
app=azure-ai-api

echo $app:"$tag"

docker build -t $app:"$tag" .
docker tag $app:"$tag" $app:latest

# 下面记得改成公司仓库
if [[ "$1" == "--push" ]]; then
  docker tag $app:"$tag" ace.azurecr.cn/bigdata/$app:"$tag"
  docker push ac.azurecr.cn/bigdata/$app:$tag
fi
